import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/Home/home.vue';
import IndexView from '@/views/Home/index.vue';
import ClaView from '@/views/Home/cla.vue';
import CartView from '@/views/Home/cart.vue';
import MyView from '@/views/Home/my.vue';
import SearchView from '@/views/Search/index.vue';
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 重定向
    { path: '/', redirect: '/home/index' },
    {
      path: '/home', component: HomeView, children: [
        { path: 'index', component: IndexView },
        { path: 'cla', component: ClaView },
        { path: 'cart', component: CartView },
        { path: 'my', component: MyView }
      ]
    },
    { path: '/search', component: SearchView }
  ],
})

export default router
